<!--
 * @Author: liuyonghu
 * @Date: 2021-12-08 21:22:50
 * @LastEditTime: 2021-12-08 21:27:30
 * @LastEditors: liuyonghu
 * @Description: 
 * @FilePath: /demos/timer/interval.html
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var index = 0;
      var interval = setInterval(() => {
        index++;
        if (index == 10) {
          clearInterval(interval);
        }
        console.log(' interval ---- ', interval," index -",index);
      }, 1000);
    </script>
  </body>
</html>
